feat: add support for OP_RETURN output on the send path - #2753
Draft
dorianvp wants to merge 6 commits into
Draft
Conversation
Adds an optional OP_RETURN (null-data) output to the send path. `zcash_client_backend` still plans and, for payload-free sends, builds the whole proposal. When a payload is present it rides the final transaction of the proposal (the ZIP-320 TEX exposure step, or the single step otherwise), which is built by driving the `zcash_primitives` transaction builder directly so `add_transparent_null_data_output` can be called; a Shield never carries a payload. Adds a validated `OpReturnData` newtype (<=80 bytes) with a typed error, and threads `Option<OpReturnData>` through `calculate_transactions`. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
dorianvp
force-pushed
the
feat/add-opreturn
branch
from
August 31, 2026 21:59
7c41daf to
621831a
Compare
Replaces the sketch stub with a working THORChain / MAYAChain swap-deposit flow. `LightClient::propose_swap_deposit(vault, amount, memo, account)` sends two transactions, the same shape as a ZIP-320 TEX pair: 1. a deshield from shielded funds to a freshly reserved, wallet-owned transparent address, built entirely by zcash_client_backend, and 2. a transparent memo carrier spending that output to the vault with the swap memo in an 80-byte OP_RETURN, hand-built on the zcash_primitives builder (the only place OP_RETURN support exists upstream). The deshield funds the carrier exactly, so the carrier has no change and always balances; its transparent input is the refundable sender THORChain / MAYAChain require. Only the transparent carrier is hand-built; the shielded spend stays in zcb, and all consensus-critical pieces (builder, ZIP-317 fee, prover, persistence) are reused from upstream. New: wallet/op_return.rs (validated OpReturnData newtype), wallet/swap.rs (fee sizing, carrier build/persist, deshield-output location), the propose_swap_deposit orchestration, and typed errors. Tests: 9 offline unit tests plus a passing regtest integration test (swap_deposit_carries_op_return_to_vault_on_chain) proving both transactions confirm on-chain with the memo in the carrier's OP_RETURN. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Removes explanatory inline comments from the OP_RETURN swap-deposit code and its tests, leaving the doc comments. No behavior change. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds an optional OP_RETURN (null-data) output to the send path by keeping
zcash_client_backendfor planning and bypassingcreate_proposed_transactionsonly for the payload-carrying transaction.